import { QuestionInfo, requestInfo } from "./type";
import service from "@/utils/request";
import { AxiosPromise } from "axios";

const { resourceService } = service;

export function getQuestion(data: requestInfo): AxiosPromise<any> {
  return resourceService({
    url: "/resource/question/background/getList",
    method: "POST",
    data: data,
  });
}

//审核

export function exmineQuestion(
  id?: number,
  status?: number
): AxiosPromise<any> {
  return resourceService({
    url: "/resource/question/audit/" + id + "/" + status,
    method: "PATCH",
  });
}

//删除
export function deleteQuestion(id?: number): AxiosPromise<any> {
  return resourceService({
    url: "/resource/question/deleteMine/" + id,
    method: "delete",
  });
}

//获取详情

export function detailQuestion(id: number): AxiosPromise<any> {
  return resourceService({
    url: "/resource/question/getById/" + id,
    method: "GET",
  });
}

export function detailQuestionBack(id: number): AxiosPromise<any> {
  return resourceService({
    url: "/resource/question/getByIdBack/" + id,
    method: "GET",
  });
}

//编辑
export function editQuestion(data: QuestionInfo): AxiosPromise<any> {
  return resourceService({
    url: "/resource/question/update",
    method: "PATCH",
    data: data,
  });
}
